<html>
<head><title>Extension Options</title>
<script type="text/javascript">

var defaultHotel = ".com";
function loadOptions() {
	var hotel = localStorage["hotel"];
	if (hotel == undefined || (hotel != ".com" && hotel != ".co.uk" && hotel != ".com.au")) {
		hotel = defaultHotel;
	}

	var select = document.getElementById("hotel");
	for (var i = 0; i < select.children.length; i++) {
		var child = select.children[i];
			if (child.value == hotel) {
			child.selected = "true";
			break;
		}
	}
}

function saveOptions() {
	var select = document.getElementById("hotel");
	var hotel = select.children[select.selectedIndex].value;
	localStorage["hotel"] = hotel;
}
function eraseOptions() {
	localStorage.removeItem("hotel");
	location.reload();
}
</script>
</head>

<body onload="loadOptions()">

<form>
<select id="hotel">
	<option value=".com">USA</option>
	<option value=".co.uk">UK</option>
	<option value=".com.au">Australia</option>
</select>
</form>

<button onclick="saveOptions()">Save</button>
<button onclick="eraseOptions()">Restore default</button>

</body>
</html>